package com.wfs.spring.config;

import com.wfs.spring.aop.Audience;
import com.wfs.spring.conditiona.MagicBean;
import com.wfs.spring.conditiona.MagicExistsCondition;
import com.wfs.spring.service.TestThreeService;
import com.wfs.spring.service.aop.Encoreable;
import com.wfs.spring.service.impl.TestThreeServiceImpl;
import com.wfs.spring.service.impl.aop.DefaultEncoreable;
import org.springframework.context.annotation.*;
@Configuration
@ComponentScan("com.wfs.spring")
@PropertySource(value = "springconfig.property")
@EnableAspectJAutoProxy
public class SpringConfig {

    @Bean
    @Profile("dev")
    public TestThreeService getTestThreeService(){
        return new TestThreeServiceImpl("dev");
    }

    @Bean
    @Profile("prod")
    public TestThreeService getProTestThreeService(){
        return new TestThreeServiceImpl("pro");
    }
    @Bean
    @Conditional(MagicExistsCondition.class)
    public MagicBean magicBean(){
     return new MagicBean();
    }
    @Bean
    public Audience audience(){
        return new Audience();
    }


}
